package com.xiaoq.vo;

import io.swagger.annotations.ApiModelProperty;

public class PagingVo{
	
	@ApiModelProperty(name = "pn", value = "页码", position=10,required=true)
	private Integer pn;

	@ApiModelProperty(name = "ps", value = "页内条数", position=20,required=true)
	private Integer ps;

	@ApiModelProperty(name = "tc", value = "满足条件总条数", position=10,hidden=true)
	private Number tc;

	public PagingVo(){}

	public PagingVo(int pn, int ps){
		this.pn = pn;
		this.ps = ps;
	}

	/**
	 *  数据偏移量
	 * @return
	 */
	public int getPageOffset(){
		if(pn!=null && ps!=null){
			return  (pn - 1) * ps;
		}
		return 0;
	}

	public Integer getPn() {
		return pn;
	}

	public void setPn(Integer pn) {
		this.pn = pn;
	}

	public Integer getPs() {
		return ps;
	}

	public void setPs(Integer ps) {
		this.ps = ps;
	}

	public Number getTc() {
		return tc;
	}

	public void setTc(Number tc) {
		this.tc = tc;
	}
}
